package com.yanxibao.mapper;

import com.yanxibao.bean.Blog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yanxibao.dto.BlogDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author kongke
* @description 针对表【yxb_blog(推文表)】的数据库操作Mapper
* @createDate 2023-11-19 20:12:25
* @Entity com.yanxibao.bean.Blog
*/
@Mapper
public interface BlogMapper extends BaseMapper<Blog> {

    @Select("select b.* , u.user_name , u.user_photo , user_specialized from yxb_blog b , yxb_user u where " +
            "if(#{userId}=null or #{userId}='',b.user_id=u.user_id,b.user_id=#{userId}and u.user_id=#{userId})  order by b.blog_time DESC")
    List<BlogDTO> queryBlog(@Param("userId") String userId);

}




